package chapter18;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.channels.FileChannel;

/**
 * @author lzy
 * @version v1.0
 * Create DateTime: 2019/3/25 11:16
 */
public class TransferTo {
    public static void copy(String src, String dest) throws IOException {
        FileChannel in = new FileInputStream(src).getChannel(),
                out = new FileOutputStream(dest).getChannel();
        in.transferTo(0, in.size(), out);
//        out.transferFrom(in, 0, in.size());
    }
}
